#include <memory>
#include<QOpenGLFunctions_4_5_Core>
#include<Shader.hpp>
#include<RenderTarget.hpp>
#include<RenderUtility.hpp>
#include<Camera.hpp>
//class GaussianData: public QOpenGLFunctions_4_5_Core
//{
//public:
//	typedef std::shared_ptr<GaussianData>	Ptr;
//
//public:
//
//	/// Constructor.
//	GaussianData(int num_gaussians, float* mean_data, float* rot_data, float* scale_data, float* alpha_data, float* color_data);
//private:
//	int _num_gaussians;
//	unsigned int meanBuffer;
//	unsigned int rotBuffer;
//	unsigned int scaleBuffer;
//	unsigned int alphaBuffer;
//	unsigned int colorBuffer;
//};
//
//class GaussianSurfaceRenderer : public QOpenGLFunctions_4_5_Core
//{
//public:
//	typedef std::shared_ptr<GaussianSurfaceRenderer>	Ptr;
//
//public:
//
//	/// Constructor.
//	GaussianSurfaceRenderer(void);
//
//	/** Render the mesh using its vertices colors, interpolated over triangles.
//	\param mesh the mesh to render
//	\param eye the viewpoint to use
//	\param dst the destination rendertarget
//	\param mode the rendering mode of the mesh
//	\param backFaceCulling should backface culling be performed
//	*/
//	//int	process(
//	//	int G,
//	//	/*input*/	const GaussianData& mesh,
//	//	/*input*/	const Camera& eye,
//	//	/*output*/	IRenderTarget& dst,
//	//	float alphaLimit,
//	//	/*mode*/    sibr::Mesh::RenderMode mode = sibr::Mesh::FillRenderMode,
//	//	/*BFC*/     bool backFaceCulling = true);
//
//	void makeFBO(int w, int h);
//
//private:
//
//	unsigned int idTexture;
//	unsigned int colorTexture;
//	unsigned int depthBuffer;
//	unsigned int fbo;
//	int resX, resY;
//
//	GLShader			_shader; ///< Color shader.
//	GLParameter			_paramMVP; ///< MVP uniform.
//	GLParameter			_paramCamPos;
//	GLParameter			_paramLimit;
//	GLParameter			_paramStage;
//	GLuint clearProg;
//	GLuint clearShader;
//};

class BufferCopyRenderer : public QOpenGLFunctions_4_5_Core
{

public:

	BufferCopyRenderer();

	void process(uint bufferID, IRenderTarget& dst, int width, int height, bool disableTest = true);

	/** \return option to flip the texture when copying. */
	bool& flip() { return _flip.get(); }
	int& width() { return _width.get(); }
	int& height() { return _height.get(); }
	~BufferCopyRenderer();
private:

	GLShader			_shader;
	GLuniform<bool>		_flip = false; ///< Flip the texture when copying.
	GLuniform<int>		_width = 1000;
	GLuniform<int>		_height = 800;
	RenderUtility* renderUtility;
};

class  MonoRdrMode : public QOpenGLFunctions_4_5_Core
{
public:
	MonoRdrMode();

	void render(const Camera& eye, RenderTarget* optDest = nullptr);

	~MonoRdrMode();
private:
	GLShader							_quadShader; ///< Passthrough shader.
	std::unique_ptr<RenderTarget>		_destRT; ///< Common destination RT.
	RenderUtility* renderUtility;
};

